﻿@model  FacturasVista
@if (Model.Facturas != null && Model.Facturas.Count > 0)
{ 
     <div style="text-align: center;">
        <table id="grilla" align="center" width="722px" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                    <th height="30">
                        <div align="left">
                            Numero de Factura</div>
                    </th>
                    <th height="30">
                        <div align="left">
                            Concepto</div>
                    </th>
                    <th height="30">
                        <div align="left">
                            Fecha</div>
                    </th>
                    <th height="30">
                        <div align="left">
                            Monto Total</div>
                    </th>
                    <th height="30">
                        <div align="right" style="margin-right: 2px;">
                            Acción</div>
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.Facturas)
                {
                    <tr>
                        <td align="left" height="30">                           
                                @item.NroFactura.ToMaxLenght(30)                           
                          
                        </td>
                        <td align="left">                           
                                @item.Concepto.ToMaxLenght(30)                          
                        </td>
                        <td align="left">                           
                                @item.FechaAlta.ToFecha()                      
                        </td>
                        <td align="left">
                            $@item.MontoTotal
                        </td>
                        <td align="right" style="margin-right: 2px;">
                            @if (ViewBag.SubMenuSelected != "Liquidacion")
                            {
                                @Html.ActionLink("Eliminar", "Eliminar", "Factura", new { Idfactura = item.IdFactura }, new { @class = "btnIngresar" })
                            }
                            else
                            {
                                @Html.ActionLink("Liquidar Factura", "VerFactura", "Factura", new { Idfactura = item.IdFactura }, new { @class = "btnIngresar" })
                            }
                        </td>
                    </tr>
                }
                @if (ViewBag.SubMenuSelected != "Liquidacion")
                {
                    <tr>
                        <td align="right" valign="middle" colspan="5" height="35px">
                            @Html.ActionLink("Agregar Factura", "Seleccion", "Factura", null, new { @class = "btnIngresar" })&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
}
else
{
    <table id="grilla" align="center" width="722px" cellpadding="0" cellspacing="0">
        <tr>
            <td width="722px">
                @Html.Partial("_SinDatos", "Facturas")
            </td>
        </tr>
        @if (ViewBag.SubMenuSelected != "Liquidacion")
        {
            <tr>
                <td align="right" width="722px" height="35px">
                    @Html.ActionLink("Agregar Factura", "Seleccion", "Factura", null, new { @class = "btnIngresar" })
                </td>
            </tr>
        }
    </table>
    
}
